package com.example.demo.design;

import cn.hutool.core.lang.Dict;
import cn.hutool.core.lang.Opt;
import cn.hutool.core.util.ReflectUtil;
import com.example.demo.entity.Menu;
import lombok.SneakyThrows;

import java.time.LocalDate;
import java.time.LocalDateTime;
import java.time.ZoneId;
import java.time.temporal.ChronoUnit;
import java.util.*;
import java.util.function.Consumer;

/**
 * 蔡定努
 * 2025/05/14 16:00
 */
public class Main {

    public static Long localDateTimeToMilliSecond(LocalDateTime localDateTime) {

        TimeZone.setDefault(TimeZone.getTimeZone("GMT-6"));
        return localDateTime.atZone(ZoneId.of("GMT-6")).toInstant().toEpochMilli();
    }


    @SneakyThrows
    public static void main(String[] args) {
        // 2025-05-19 04:50:06
        TimeZone.setDefault(TimeZone.getTimeZone("GMT-6"));
        LocalDateTime localDateTime = LocalDateTime.of(2025, 5, 19, 4, 50, 06);
        LocalDateTime localDateTime1 = localDateTime.plusHours(6);
        System.out.println("6小时候:"+localDateTime1);
        System.out.println("当前时间:"+LocalDateTime.now());

        LocalDateTime now = LocalDateTime.of(2025, 5, 29, 4, 50, 06);
        long millisecondsBetween = ChronoUnit.MILLIS.between(now,localDateTime1);
        
        
        
System.out.println("millisecondsBetween: " + Math.max(0,millisecondsBetween));
        double hours = (millisecondsBetween) /(1000*60);

        System.out.println("millisecondsBetween: " + hours);


    }
}
